package com.kurumi.bo;

public class Page {
	private Integer page;// 当前数据对应的页码
	private Integer recTotal;// 总的数据数目
	private Integer recPerPage;// 每页数据数目

	public Integer getRecPerPage() {
		if (recPerPage == 0) {
			recPerPage = 10;
		}
		return recPerPage;
	}

	public void setRecPerPage(Integer recPerPage) {
		this.recPerPage = recPerPage;
	}

	public Integer getPage() {
		if (page <= 0) {
			page = 1;
		}
		if (page > getTotalPage()) {
			page = getTotalPage();
		}
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getTotalPage() {
		int totalPage = 0;

		if (this.recTotal % this.recPerPage == 0) {
			totalPage = this.recTotal / this.recPerPage;
		} else {
			totalPage = this.recTotal / this.recPerPage + 1;
		}
		return totalPage;
	}

	public Integer getRecTotal() {
		return recTotal;
	}

	public void setRecTotal(Integer recTotal) {
		this.recTotal = recTotal;
	}

}
